#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<string.h>

int main()
{
    int i, l, p1, p2, p3, b, c, d;
    scanf("%d %d %d", &p1, &p2, &p3);
    char a[100] = { 0 }, e;
    scanf("%s", &a);
    l = strlen(a);
    for (i = 0; i < l; i++)
    {
        if (a[i + 1] == '-' && a[i] >= 'a' && a[i] <= 'z' && a[i + 2] >= 'a' && a[i + 2] <= 'z' || a[i + 1] == '-' && a[i] >= '0' && a[i] <= '9' && a[i + 2] >= '0' && a[i + 2] <= '9')
        {
            printf("%c", a[i]);
            b = a[i];
            c = a[i + 2];
            if (c < b + 1)
            {
                printf("%c", a[i + 1]);
            }
            else if (c > b + 1)
            {
                if (p3 == 1)
                {
                    d = a[i] + 1;
                    while (d != c)
                    {
                        e = d;
                        if (p1 == 2)
                        {
                            if (e >= 'a' && e <= 'z')
                                e -= 32;
                        }
                        else if (p1 == 3)
                        {
                            e = 42;
                        }
                        for (int j = 1; j <= p2; j++)
                            printf("%c", e);
                        d++;
                    }
                }
                else
                {
                    d = a[i + 2] - 1;
                    while (d != b)
                    {
                        e = d;
                        if (p1 == 2)
                        {
                            if (e >= 'a' && e <= 'z')
                                e -= 32;
                        }
                        else if (p1 == 3)
                        {
                            e = 42;
                        }
                        for (int j = 1; j <= p2; j++)
                            printf("%c", e);
                        d--;
                    }
                }
            }
            i = i + 1;
        }
        else
            printf("%c", a[i]);
    }
    return 0;
}